<html>
<head>
<style type="text/css">
	@import "postarray.css";
</style>

<script language="javascript">
	fields = 0;
	function addInput() {
		if (fields != 10) {
			document.getElementById('form_rows').innerHTML += '<div id="form_row"><input type=text name="img[]" size=50></div>';
			fields += 1;
		} else {
			document.getElementById('form_rows').innerHTML += "<br />Only 10 upload fields allowed.";
			document.form.add.disabled = true;
		}
	}
</script>
</head>
<body>

	<div id="form">
		<form method=GET action=update.php enctype=multipart/form-data>
			<div id="form_header">
				Files to upload:
			</div>
			<div id="form_rows">
				
				<?php
				// Make a MySQL Connection
				mysql_connect("localhost", "kindle", "furrball") or die(mysql_error());
				mysql_select_db("kindle") or die(mysql_error());
				
				// Retrieve all the data from the "example" table
				$result = mysql_query("SELECT * FROM rss_sources where user_id=1")
				or die(mysql_error());  
				
				while($row = mysql_fetch_array($result)) {
				  echo '<div id="form_row"><input type=text name="img[]" size=50 value="'.$row['url'].'"></div>';
				}
				?>
				
			</div>
			<div id="form_buttons">
				<input type="button" onclick="addInput()" name="add" value="Add input field" /> 
				<input type=submit name=submit value=Enviar>
			</div>
		</form>
	</div>
</body>

